#!/bin/bash


base_dir=$(dirname $0)/..

for file in $base_dir/addon/*.jar;
do
  CLASSPATH=$CLASSPATH:$file
done

for file in $base_dir/dist/*.jar;
do
  CLASSPATH=$CLASSPATH:$file
done

for file in $base_dir/lib/*.jar;
do
  CLASSPATH=$CLASSPATH:$file
done

CLASSPATH=$CLASSPATH:$base_dir/dist/resources

if [ -z $VOLD_OPTS ]; then
VOLD_OPTS="-Dcom.sun.management.jmxremote"
fi

# Min, max, total JVM size (-Xms -Xmx)
JVM_SIZE="-server -Xms500m -Xmx500m"

# New Generation Sizes (-XX:NewSize -XX:MaxNewSize)
#JVM_SIZE_NEW="-XX:NewSize=2048m -XX:MaxNewSize=2048m"

# Type of Garbage Collector to use
JVM_GC_TYPE="-XX:+UseConcMarkSweepGC -XX:+UseParNewGC"

# Tuning options for the above garbage collector
JVM_GC_OPTS="-XX:CMSInitiatingOccupancyFraction=70"

# JVM GC activity logging settings ($LOG_DIR set in the ctl script)
JVM_GC_LOG="-XX:+PrintTenuringDistribution -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -Xloggc:./logs/gc.log"

java -Dlog4j.configuration=addon/log4j.xml $VOLD_OPTS $JVM_SIZE $JVM_SIZE_NEW $JVM_GC_TYPE $JVM_GC_OPTS $JVM_GC_LOG -XX:MaxGCPauseMillis=500 -cp $CLASSPATH voldemort.store.cachestore.TestStore $@
